package com.kotlin.flong.coroutines

/**
 * @Author:liangjl
 * @Date: 2020/7/6-20:30
 * @Eamil:jilongliang@sina.com
 * @Description:
 */
fun main() {

    test1(10, action = {
        println("test1")
    })

    test2(10, action = {
        println(it)
    })

    //kotlin ::方法，方法引用
    test4(10, ::test5)

}

/**
 * [num]整型
 * [action]不接收参数
 */
fun test1(num: Int, action: () -> Unit) {

}

/**
 * action接收一个Int参数 [action]
 */
fun test2(num: Int, action: (Int) -> Unit) {
}

fun test3() {

}

fun test4(num: Int, action: (Int, Int) -> Unit) {
    action(num, 10)
}

fun test5(a: Int, b: Int) {
    println("a + b= " + (a + b))
}